  var gulp = require('gulp'),
      rename = require('gulp-rename'),
      htmlMin  = require('gulp-htmlmin'),
      smushit = require('gulp-smushit'),
      uglify = require("gulp-uglify"),
      minifyCss = require("gulp-minify-css");
      // concat = require('gulp-concat'),
      // rev=require('gulp-rev'),                             revCollector = require('gulp-rev-collector');

  gulp.task('minify-js', function () {
      gulp.src(['js/*.js'])
      // .pipe(concat('apple.min.js'))
      .pipe(uglify())
      .pipe(rename({suffix: '.min'}))
      .pipe(gulp.dest('./allpeMin/js'));
  })
  gulp.task('minify-css', function () {
    gulp.src(['./css/*.css'])
    // .pipe(concat('apple.min.css'))
    .pipe(minifyCss())
    .pipe(rename({suffix: '.min'}))
    .pipe(gulp.dest('./allpeMin/css'));
  })
  gulp.task('html', function () {
    var options = {
        removeComments: true,//清除HTML注释
        collapseWhitespace: true,//压缩HTML
    };
    gulp.src('./html/apple.html')
        .pipe(htmlMin(options))
        .pipe(gulp.dest('./allpeMin/html'))

    });
  gulp.task('default', function () {
      return gulp.src('./images/*.{jpg,png,PNG}')
          .pipe(smushit())
          .pipe(gulp.dest('./allpeMin/images'));
  });

  gulp.task('prod', ['minify-js', 'minify-css', 'html', 'default']);



//     htmlmin = require('gulp-htmlmin');
//     gulp.task('testHtmlmin', function () {
//     var options = {
//         removeComments: true,//清除HTML注释
//         collapseWhitespace: true,//压缩HTML
//         collapseBooleanAttributes: true,//省略布尔属性的值 <input checked="true"/> ==> <input />
//         removeEmptyAttributes: true,//删除所有空格作属性值 <input id="" /> ==> <input />
//         removeScriptTypeAttributes: true,//删除<script>的type="text/javascript"
//         removeStyleLinkTypeAttributes: true,//删除<style>和<link>的type="text/css"
//         minifyJS: true,//压缩页面JS
//         minifyCSS: true//压缩页面CSS
//     };
//     gulp.src('./html/*.html')
//         .pipe(htmlmin(options))
//         .pipe(gulp.dest('./html-min'));
// });
//

// var smushit = require('gulp-smushit');
//
// gulp.task('default', function () {
//     return gulp.src('./images/*.{jpg,png}')
//         .pipe(smushit())
//         .pipe(gulp.dest('./images-min'));
// });
